package at.jku.se.fastsell.db4o.transactions;

import at.jku.se.fastsell.data.User;
import at.jku.se.fastsell.db4o.DatabaseException;

public class StoreUserTransaction extends Transaction<Void> {

	private User u;
	
	// --------------------------------------------------------------------------------------------
	
	public StoreUserTransaction(User u) {
		this.u = u;
	}
	
	// --------------------------------------------------------------------------------------------

	@Override
	public Void run() throws DatabaseException {
		db.ext().store(u, 1);
		commit();
		
		return null;
	}
	
	// --------------------------------------------------------------------------------------------
	
	@Override
	public String toString() {
		return super.toString() + ": " + u;
	}
	
}
